<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});

$api = app('Dingo\Api\Routing\Router');
$api->version('v1', [
    'namespace' => 'App\Http\Controllers\Api\V1',
], function ($api) {
    $api->group(['prefix' => 'auth'], function ($api) {
        //登录
        $api->post('login', [
            'uses' => 'AuthController@login',
        ]);

        // 个人信息
        $api->get('me', [
                'middleware' => 'api.auth',
                'uses' => 'AuthController@me',
        ]);
    });

    // 公告信息
    $api->get('notice/list', [
        'middleware' => 'api.auth',
        'uses' => 'NoticeController@lists',
    ]);

    // 课程信息
    $api->get('book/list', [
        'middleware' => 'api.auth',
        'uses' => 'BookController@lists',
    ]);

    // 当前课程信息
    $api->get('curriculum/detail', [
        'middleware' => 'api.auth',
        'uses' => 'BookController@curriculum',
    ]);


});
